<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTransactionLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('transaction_logs', function (Blueprint $table) {
            $table->id()->comment('交易统计表');
            $table->integer('user_id')->index()->comment('用户id');
            $table->integer('mer_id')->nullable()->index()->comment('商户id');
            $table->decimal('turnover_price',8,2)->comment('营业额');
            $table->decimal('transactior_price',8,2)->comment('交易毛利金额');
            $table->decimal('pay_price',8,2)->comment('商品支付金额');
            $table->decimal('money_price',8,2)->comment('购买会员金额');
            $table->decimal('price',8,2)->comment('充值金额');
            $table->decimal('number',8,2)->comment('支出金额');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('transaction_logs');
    }
}
